package com.inibb.app.pagination.dto;

import java.util.HashMap;
import java.util.Map;

public class PaginationCriteria<T> implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private int rowStart;
	
	private int rowEnd;
	
	private int page;
	
	private PageFilter pageFilter = new PageFilter( );
	
	private PageSorter pageSorter = new PageSorter( );
	
	private Map<String, Object> filter = new HashMap<String, Object>();
	
//	private T t;
//
//	public T getT() {
//		return t;
//	}
//
//
//
//	public void setT(T t) {
//		this.t = t;
//	}



	public PaginationCriteria(int rowStart, int rowEnd, PageFilter pageFilter,
			PageSorter pageSorter) {
		super();
		this.rowStart = rowStart;
		this.rowEnd = rowEnd;
		this.pageFilter = pageFilter;
		this.pageSorter = pageSorter;
	}
	
	

	public PaginationCriteria(int rowStart, int rowEnd) {
		super();
		this.rowStart = rowStart;
		this.rowEnd = rowEnd;
	}



	public PaginationCriteria(PageFilter pageFilter, PageSorter pageSorter) {
		super();
		this.pageFilter = pageFilter;
		this.pageSorter = pageSorter;
	}



	public PaginationCriteria() {
		super();
	}
	
	public void addFilter(String key,Object value){
		filter.put(key, value);
	}

	public int getRowStart() {
		return rowStart;
	}

	public void setRowStart(int rowStart) {
		this.rowStart = rowStart;
	}

	public int getRowEnd() {
		return rowEnd;
	}

	public void setRowEnd(int rowEnd) {
		this.rowEnd = rowEnd;
	}
	

	public PageFilter getPageFilter() {
		return pageFilter;
	}

	public void setPageFilter(PageFilter pageFilter) {
		this.pageFilter = pageFilter;
	}

	public PageSorter getPageSorter() {
		return pageSorter;
	}

	public void setPageSorter(PageSorter pageSorter) {
		this.pageSorter = pageSorter;
	}



	public int getPage() {
		return rowEnd-rowStart;
	}



	public void setPage(int page) {
		this.page = page;
	}



	public Map<String, Object> getFilter() {
		return filter;
	}



	public void setFilter(Map<String, Object> criteria) {
		this.filter = criteria;
	}
	
	
	
}
